package com.well.rpc.netty;

import io.netty.channel.Channel;
import java.net.InetSocketAddress;
import java.net.SocketAddress;

public class ChannelClientFactory {

    /**
     *  Create Channel by {host} {port}
     * @param host
     * @param port
     * @return
     */
    public static Channel createChannel(String host, Integer port) {
        InetSocketAddress inetSocketAddress = new InetSocketAddress(host, port);
        return createChannel(inetSocketAddress);
    }

    /**
     * Create Channel by socketAddress
     * @param socketAddress
     * @return
     */
    public static Channel createChannel(SocketAddress socketAddress) {
        RpcClient base = new RpcClient();
        return  base.createChannel(null, socketAddress);
    }
}
